package com.thrd.taiexhibition.model;

import com.alibaba.fastjson.JSON;
import com.thrd.basicframework.http.OkHttpUtils;
import com.thrd.basicframework.http.callback.ThrdCallBack;
import com.thrd.taiexhibition.bean.BeanEnterprise;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.utils.Constant;

/**
 * @author: ${唐杰}
 * @date: 2021/3/31
 */
public class EnterpriseHomeModel {

    public static final String TAG="EnterpriseHomeModel";


    /**
     * 获取企业信息
     */
    public void getEnterpriseHome(String id,final MvpCallback<BeanEnterprise> mvpCallback) {
        OkHttpUtils.post().url(Constant.HTTP_ENTERPRISE_DATA)
                .tag(TAG)
                .addParams("companyId", id)
                .build().execute(new ThrdCallBack<BeanEnterprise>() {
            @Override
            public void onFailed(String e, int code) {
                mvpCallback.onFailed(e, code);
            }

            @Override
            public void onResponse(BeanEnterprise response, int id) {
                mvpCallback.onSuccess(response);
            }

            @Override
            public BeanEnterprise onJson(String s) {
                return JSON.parseObject(s, BeanEnterprise.class);
            }


        });
    }

}
